//
//  AYStatusBottomView.swift
//  iOSSinaWeb
//
//  Created by yws on 16/5/20.
//  Copyright © 2016年 yws. All rights reserved.
//

import UIKit

class AYStatusBottomView: UIView {

    
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        prepareUI()
        
        retweetButton.addTarget(self, action: "retweetBtnClick", forControlEvents: UIControlEvents.TouchUpInside)
        commentButton.addTarget(self, action: "commentBtnClick", forControlEvents: UIControlEvents.TouchUpInside)
        zanButton.addTarget(self, action: "zanBtnClick", forControlEvents: UIControlEvents.TouchUpInside)
    }
    
    
    private func prepareUI() {
     
//        backgroundColor = UIColor.cyanColor()
        ///添加子控件
        addSubview(retweetButton)
        addSubview(commentButton)
        addSubview(zanButton)
        
        ///添加约束
        retweetButton.snp_makeConstraints { (make) in
            make.leading.top.bottom.equalTo(self)
        }
        
        commentButton.snp_makeConstraints { (make) in
            make.leading.equalTo(retweetButton.snp_trailing)
            make.top.bottom.equalTo(self)
            make.width.equalTo(retweetButton)
        }
        
        zanButton.snp_makeConstraints { (make) in
            make.leading.equalTo(commentButton.snp_trailing)
            make.top.bottom.trailing.equalTo(self)
            make.width.equalTo(retweetButton)
        }
    }
    
    // MARK: - 三个按钮点击的方法
    @objc func retweetBtnClick() {
        AMPrint(items: "点击了转发")
    }
    
    @objc func commentBtnClick() {
        AMPrint(items: "点击了评论")
    }
    
    @objc func zanBtnClick() {
        AMPrint(items: "点击了赞")
    }
    
    
    
    // MARK: - lazy
    ///转发
    private lazy var retweetButton: UIButton = UIButton(bkgImageName: "timeline_card_bottom_background", imageName: "timeline_icon_retweet", title: "转发")
    ///评论
    private lazy var commentButton:UIButton = UIButton(bkgImageName: "timeline_card_bottom_background", imageName: "timeline_icon_comment", title: "评论")
    ///赞
    private lazy var zanButton: UIButton = UIButton(bkgImageName: "timeline_card_bottom_background", imageName: "timeline_icon_unlike", title: "赞")
    
}
